﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lwm.x10c.Emulator
{
    public class WrappedArray
    {
        private ushort[] array;
        private string name;
        private string[] entryNames;

        public WrappedArray(string name, int size, string[] entryNames = null)
        {
            this.name = name;
            this.array = new ushort[size];
            this.entryNames = entryNames;
        }

        public ushort this[int key]
        {
            get
            {
                //Console.WriteLine(array[key] + " == " + name + "[" + key + "]");
                return array[key];
            }
            set
            {
                if (entryNames != null && key < entryNames.Length)
                    Console.WriteLine(entryNames[key] + " = " + value);
                else
                    Console.WriteLine(name + "[" + key + "] = " + value);
                array[key] = value;
            }
        }
    }
}
